package com.bnz.listener;

import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@WebListener
public class MyRequestListener implements ServletRequestListener, ServletRequestAttributeListener {

	//1. 监听组件本身的变化
	@Override
	public void requestInitialized(ServletRequestEvent sre) {
		System.out.println("请求对象被创建。。。");
	}

	@Override
	public void requestDestroyed(ServletRequestEvent sre) {
		System.out.println("请求对象被销毁。。。");
	}

	//2. 监听组件属性值的变化
	@Override
	public void attributeAdded(ServletRequestAttributeEvent srae) {
		System.out.println("为请求对象添加属性值。。。");
	}

	@Override
	public void attributeRemoved(ServletRequestAttributeEvent srae) {
		System.out.println("为请求对象移除属性值。。。");
	}

	@Override
	public void attributeReplaced(ServletRequestAttributeEvent srae) {

	}

}
